function request(url,data,method,session){
  
  let header = { "Cookie":session };
  let targetUrl = "https://wxserver.czstudio.tech/api/" + url;
 
  return new Promise((resolve,reject)=>{
    wx.request({
      url: targetUrl,
      method:method,
      data:data,
      header,
      timeout:50000,
      success(res){
        resolve(res.data)
      },
      fail(err){
       console.log("err",err)
        reject(err)
      }
    })
  })
}
function login(url,data,method){
  console.log(data)
  let targetUrl = "https://wxserver.czstudio.tech/api/" + url;
  console.log("targetUrl",targetUrl)
  return new Promise((resolve,reject)=>{
    wx.request({
      url: targetUrl,
      method:method,
      data:data,
      success(res){
        console.log(res)
        resolve(res)
      },
      fail(err){
        console.log(111,err)
        resolve(err)
      }
    })
  })
}
function file(url,data,method,session){
  let header = { "Cookie":session }
  return new Promise((resolve,reject)=>{
    wx.request({
      url: "https://wxserver.czstudio.tech/api/" + url,
      method:method,
      data:data,
      header,
      success(res){
        resolve(res.data)
      },
      fail(err){
        console.log("1221",err)
        reject(err)
      }
    })
  })
}
module.exports ={
  request,
  login,
  file
}